home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16626 < prev    next >
Mailbox/MIME Entity  |  1996-08-05  |  1.5 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: Mailbox/MIME Entity (archive/mbox).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Mailbox/MIME Entity (archive/mbox) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file C source text default
99% file C source, ISO-8859 text default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/950 MIME Email (1.0) default
100% detectItEasy Format: plain text[LF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 4e 65 77 73 67 72 6f 75 | 70 73 3a 20 63 6f 6d 70 |Newsgrou|ps: comp|
|00000010| 2e 6c 61 6e 67 2e 63 2b | 2b 0a 50 61 74 68 3a 20 |.lang.c+|+.Path: |
|00000020| 61 72 74 65 6d 69 73 2e | 73 74 6f 2e 66 64 61 74 |artemis.|sto.fdat|
|00000030| 61 2e 73 65 21 6e 65 77 | 73 0a 46 72 6f 6d 3a 20 |a.se!new|s.From: |
|00000040| 4e 69 6b 6c 61 73 20 4d | 65 6c 6c 69 6e 20 3c 6e |Niklas M|ellin <n|
|00000050| 69 6b 6c 61 73 2e 6d 65 | 6c 6c 69 6e 40 73 74 6f |iklas.me|llin@sto|
|00000060| 2e 66 64 61 74 61 2e 73 | 65 3e 0a 53 75 62 6a 65 |.fdata.s|e>.Subje|
|00000070| 63 74 3a 20 52 65 3a 20 | 41 72 72 61 79 20 6f 66 |ct: Re: |Array of|
|00000080| 20 46 75 6e 63 69 6f 6e | 73 20 3f 3f 0a 53 65 6e | Funcion|s ??.Sen|
|00000090| 64 65 72 3a 20 6e 65 77 | 73 40 61 72 74 65 6d 69 |der: new|s@artemi|
|000000a0| 73 2e 73 74 6f 2e 66 64 | 61 74 61 2e 73 65 20 28 |s.sto.fd|ata.se (|
|000000b0| 55 73 65 4e 65 74 20 4e | 65 74 4e 65 77 73 29 0a |UseNet N|etNews).|
|000000c0| 4d 65 73 73 61 67 65 2d | 49 44 3a 20 3c 33 31 36 |Message-|ID: <316|
|000000d0| 44 31 44 42 35 2e 31 38 | 43 37 40 73 74 6f 2e 66 |D1DB5.18|C7@sto.f|
|000000e0| 64 61 74 61 2e 73 65 3e | 0a 44 61 74 65 3a 20 54 |data.se>|.Date: T|
|000000f0| 68 75 2c 20 31 31 20 41 | 70 72 20 31 39 39 36 20 |hu, 11 A|pr 1996 |
|00000100| 31 34 3a 35 36 3a 35 33 | 20 47 4d 54 0a 54 6f 3a |14:56:53| GMT.To:|
|00000110| 20 54 68 6f 6d 61 73 20 | 41 72 6d 73 74 72 6f 6e | Thomas |Armstron|
|00000120| 67 20 4b 6f 62 72 69 63 | 68 20 3c 74 61 72 6d 73 |g Kobric|h <tarms|
|00000130| 74 72 6f 40 63 61 6c 65 | 75 63 68 65 2e 69 6e 66 |tro@cale|uche.inf|
|00000140| 2e 55 44 45 43 2e 43 4c | 3e 0a 43 6f 6e 74 65 6e |.UDEC.CL|>.Conten|
|00000150| 74 2d 54 72 61 6e 73 66 | 65 72 2d 45 6e 63 6f 64 |t-Transf|er-Encod|
|00000160| 69 6e 67 3a 20 37 62 69 | 74 0a 43 6f 6e 74 65 6e |ing: 7bi|t.Conten|
|00000170| 74 2d 54 79 70 65 3a 20 | 74 65 78 74 2f 70 6c 61 |t-Type: |text/pla|
|00000180| 69 6e 3b 20 63 68 61 72 | 73 65 74 3d 75 73 2d 61 |in; char|set=us-a|
|00000190| 73 63 69 69 0a 52 65 66 | 65 72 65 6e 63 65 73 3a |scii.Ref|erences:|
|000001a0| 20 3c 34 6b 67 72 32 63 | 24 62 39 39 40 6e 65 77 | <4kgr2c|$b99@new|
|000001b0| 73 2e 64 70 69 2e 75 64 | 65 63 2e 63 6c 3e 0a 4d |s.dpi.ud|ec.cl>.M|
|000001c0| 69 6d 65 2d 56 65 72 73 | 69 6f 6e 3a 20 31 2e 30 |ime-Vers|ion: 1.0|
|000001d0| 0a 58 2d 4d 61 69 6c 65 | 72 3a 20 4d 6f 7a 69 6c |.X-Maile|r: Mozil|
|000001e0| 6c 61 20 32 2e 30 20 28 | 57 69 6e 4e 54 3b 20 49 |la 2.0 (|WinNT; I|
|000001f0| 29 0a 4f 72 67 61 6e 69 | 7a 61 74 69 6f 6e 3a 20 |).Organi|zation: |
|00000200| 57 4d 2d 64 61 74 61 20 | 46 f6 72 73 76 61 72 73 |WM-data |F.rsvars|
|00000210| 64 61 74 61 20 41 42 2c | 20 53 77 65 64 65 6e 0a |data AB,| Sweden.|
|00000220| 0a 54 68 6f 6d 61 73 20 | 41 72 6d 73 74 72 6f 6e |.Thomas |Armstron|
|00000230| 67 20 4b 6f 62 72 69 63 | 68 20 77 72 6f 74 65 3a |g Kobric|h wrote:|
|00000240| 0a 3e 20 0a 3e 20 20 20 | 20 20 20 20 20 20 48 69 |.> .> | Hi|
|00000250| 20 74 68 65 72 65 3a 0a | 3e 20 0a 3e 20 20 20 20 | there:.|> .> |
|00000260| 20 20 20 20 20 49 27 76 | 65 20 74 68 65 20 66 6f | I'v|e the fo|
|00000270| 6c 6c 6f 77 69 6e 67 20 | 70 72 6f 62 6c 65 6d 2e |llowing |problem.|
|00000280| 20 49 20 57 61 6e 74 20 | 74 6f 20 64 65 66 69 6e | I Want |to defin|
|00000290| 65 20 61 6e 20 61 72 72 | 61 79 0a 3e 20 6f 66 20 |e an arr|ay.> of |
|000002a0| 66 75 6e 63 74 69 6f 6e | 73 20 28 61 6c 6c 20 77 |function|s (all w|
|000002b0| 69 74 68 20 74 68 65 20 | 73 61 6d 65 20 72 65 74 |ith the |same ret|
|000002c0| 75 72 6e 20 76 61 6c 75 | 65 20 61 6e 20 74 68 65 |urn valu|e an the|
|000002d0| 20 73 61 6d 65 20 70 61 | 72 61 6d 65 74 65 72 73 | same pa|rameters|
|000002e0| 2c 0a 3e 20 6f 66 20 63 | 6f 75 72 73 65 29 2c 20 |,.> of c|ourse), |
|000002f0| 6e 61 6d 65 64 20 46 75 | 6e 63 41 72 72 61 79 2c |named Fu|ncArray,|
|00000300| 20 62 75 74 20 49 27 64 | 6f 6e 74 20 6b 6e 6f 77 | but I'd|ont know|
|00000310| 20 68 6f 77 20 74 6f 20 | 64 6f 20 69 74 2e 0a 0a | how to |do it...|
|00000320| 54 68 65 20 65 61 73 69 | 65 73 74 20 77 61 79 20 |The easi|est way |
|00000330| 69 73 20 74 6f 20 75 73 | 65 20 61 20 74 79 70 65 |is to us|e a type|
|00000340| 64 65 66 20 74 6f 20 63 | 6c 65 61 72 20 75 70 20 |def to c|lear up |
|00000350| 74 68 65 20 6d 65 73 73 | 79 20 73 79 6e 74 61 78 |the mess|y syntax|
|00000360| 2e 0a 48 65 72 65 20 69 | 73 20 61 20 73 69 6d 70 |..Here i|s a simp|
|00000370| 6c 65 20 65 78 61 6d 70 | 6c 65 3a 0a 0a 23 69 6e |le examp|le:..#in|
|00000380| 63 6c 75 64 65 20 3c 69 | 6f 73 74 72 65 61 6d 2e |clude <i|ostream.|
|00000390| 68 3e 0a 0a 74 79 70 65 | 64 65 66 20 76 6f 69 64 |h>..type|def void|
|000003a0| 20 28 2a 46 75 6e 63 29 | 28 29 3b 20 2f 2f 20 46 | (*Func)|(); // F|
|000003b0| 75 6e 63 20 3d 20 50 6f | 69 6e 74 65 72 20 74 6f |unc = Po|inter to|
|000003c0| 20 61 20 66 75 6e 63 74 | 69 6f 6e 0a 0a 76 6f 69 | a funct|ion..voi|
|000003d0| 64 20 66 6f 6f 30 28 29 | 0a 7b 0a 20 20 63 6f 75 |d foo0()|.{. cou|
|000003e0| 74 20 3c 3c 20 22 66 6f | 6f 30 22 20 3c 3c 20 65 |t << "fo|o0" << e|
|000003f0| 6e 64 6c 3b 0a 7d 0a 0a | 76 6f 69 64 20 66 6f 6f |ndl;.}..|void foo|
|00000400| 31 28 29 0a 7b 0a 20 20 | 63 6f 75 74 20 3c 3c 20 |1().{. |cout << |
|00000410| 22 66 6f 6f 31 22 20 3c | 3c 20 65 6e 64 6c 3b 0a |"foo1" <|< endl;.|
|00000420| 7d 0a 0a 76 6f 69 64 20 | 66 6f 6f 32 28 29 0a 7b |}..void |foo2().{|
|00000430| 0a 20 20 63 6f 75 74 20 | 3c 3c 20 22 66 6f 6f 32 |. cout |<< "foo2|
|00000440| 22 20 3c 3c 20 65 6e 64 | 6c 3b 0a 7d 0a 0a 69 6e |" << end|l;.}..in|
|00000450| 74 20 6d 61 69 6e 28 29 | 0a 7b 0a 20 20 46 75 6e |t main()|.{. Fun|
|00000460| 63 20 66 75 6e 63 41 72 | 72 61 79 5b 33 5d 3b 0a |c funcAr|ray[3];.|
|00000470| 0a 20 20 66 75 6e 63 41 | 72 72 61 79 5b 30 5d 20 |. funcA|rray[0] |
|00000480| 3d 20 66 6f 6f 30 3b 0a | 20 20 66 75 6e 63 41 72 |= foo0;.| funcAr|
|00000490| 72 61 79 5b 31 5d 20 3d | 20 66 6f 6f 31 3b 0a 20 |ray[1] =| foo1;. |
|000004a0| 20 66 75 6e 63 41 72 72 | 61 79 5b 32 5d 20 3d 20 | funcArr|ay[2] = |
|000004b0| 66 6f 6f 32 3b 0a 0a 20 | 20 66 6f 72 20 28 69 6e |foo2;.. | for (in|
|000004c0| 74 20 69 20 3d 20 30 3b | 20 69 20 3c 20 33 3b 20 |t i = 0;| i < 3; |
|000004d0| 2b 2b 69 29 0a 20 20 20 | 20 66 75 6e 63 41 72 72 |++i). | funcArr|
|000004e0| 61 79 5b 69 5d 28 29 3b | 0a 0a 20 20 72 65 74 75 |ay[i]();|.. retu|
|000004f0| 72 6e 20 30 3b 0a 7d 0a | 0a 49 66 20 79 6f 75 20 |rn 0;.}.|.If you |
|00000500| 72 65 61 6c 6c 79 20 77 | 61 6e 74 20 74 6f 20 64 |really w|ant to d|
|00000510| 65 63 6c 61 72 65 20 74 | 68 65 20 61 72 72 61 79 |eclare t|he array|
|00000520| 20 20 77 69 74 68 6f 75 | 74 20 74 68 65 20 74 79 | withou|t the ty|
|00000530| 70 65 64 65 66 20 0a 74 | 68 65 20 73 79 6e 74 61 |pedef .t|he synta|
|00000540| 78 20 69 73 3a 0a 0a 20 | 20 76 6f 69 64 20 28 2a |x is:.. | void (*|
|00000550| 66 75 6e 63 41 72 72 61 | 79 5b 33 5d 29 28 29 3b |funcArra|y[3])();|
|00000560| 0a 0a 49 4d 48 4f 20 74 | 68 69 73 20 6d 69 67 68 |..IMHO t|his migh|
|00000570| 74 20 62 65 20 6c 6f 67 | 69 63 61 6c 20 74 6f 20 |t be log|ical to |
|00000580| 63 6f 6d 70 75 74 65 72 | 73 2c 20 62 75 74 20 6e |computer|s, but n|
|00000590| 6f 74 20 74 6f 20 68 75 | 6d 61 6e 73 2c 20 0a 73 |ot to hu|mans, .s|
|000005a0| 6f 20 49 20 61 6c 77 61 | 79 73 20 75 73 65 20 74 |o I alwa|ys use t|
|000005b0| 79 70 65 64 65 66 20 77 | 68 65 6e 20 49 20 6d 65 |ypedef w|hen I me|
|000005c0| 73 73 20 61 72 6f 75 6e | 64 20 77 69 74 68 20 70 |ss aroun|d with p|
|000005d0| 6f 69 6e 74 65 72 73 20 | 74 6f 20 0a 66 75 6e 63 |ointers |to .func|
|000005e0| 74 69 6f 6e 73 2e 0a 0a | 2d 2d 2d 0a 4e 69 6b 6c |tions...|---.Nikl|
|000005f0| 61 73 20 4d 65 6c 6c 69 | 6e 0a |as Melli|n. |
+--------+-------------------------+-------------------------+--------+--------+